﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.ModelBinding;
using System.Web.UI.WebControls;
using Box.BL;
using Box.Entities;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;

namespace WEB
{
    public partial class frmListCategoria : System.Web.UI.Page
    {
        [Dependency]
        public ICategoriaBL CategoriaBl { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var container = new UnityContainer())
            {
                container.LoadConfiguration();
                container.BuildUp(this.GetType(), this);
            }
        }
        public List<Categoria> GetCategorias([Control("txtCriterio")]string criterio)
        {
            return CategoriaBl.GetFromCategoriasByCriterio(criterio);
        }
        protected void odsCategoria_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
        {
            e.ObjectInstance = CategoriaBl;
        }
    }
}